﻿using System;
using Prometheus.UIUtility.Storage.IsolatedStorage;

namespace DeepMixWorkflow
{
    public static class StorageContainer
    {
        /// <summary>
        /// Версия, с которой обновляемся
        /// </summary>
        public static readonly IsolatedStorageProperty<int> UpdateVersion = new IsolatedStorageProperty<int>("UpdateVersion", true, true, () => 1);

        /// <summary>
        ///     Время следующего обновления
        /// </summary>
        public static readonly IsolatedStorageProperty<DateTime> RefreshTime =
            new IsolatedStorageProperty<DateTime>("refreshTime", true, true, () => DateTime.Now);

        /// <summary>
        ///     Следующее обновление избранного
        /// </summary>
        public static readonly IsolatedStorageProperty<DateTime> RefreshSelectedDate =
            new IsolatedStorageProperty<DateTime>("RefreshSelectedDate", true, true, () => DateTime.Now.Date);

        /// <summary>
        ///     Имя картинки на сервере
        /// </summary>
        public static readonly IsolatedStorageProperty<string> ImageName =
            new IsolatedStorageProperty<string>("ImageName");

        /// <summary>
        ///     Было ли инициализировано приложение (Был ли первый запуск)
        /// </summary>
        public static readonly IsolatedStorageProperty<bool> IsInitialized =
            new IsolatedStorageProperty<bool>("firstLoaded", true);

        /// <summary>
        ///     Адрес сервера
        /// </summary>
        public static readonly IsolatedStorageProperty<string> ServerAddress =
            new IsolatedStorageProperty<string>("serverAddress", true);

        /// <summary>
        ///     Ошибка при соединении с сервером
        /// </summary>
        public static readonly IsolatedStorageProperty<bool> IsError = new IsolatedStorageProperty<bool>("IsError", true,
                                                                                                         true,
                                                                                                         () => false);

        /// <summary>
        ///     Сдвиг локального времени относительно времени DeepMix
        /// </summary>
        public static readonly IsolatedStorageProperty<TimeSpan> LocalTimeShift =
            new IsolatedStorageProperty<TimeSpan>("LocalTimeShift", true, true, () => TimeSpan.Zero);

        /// <summary>
        ///     Обновлён ли тайл
        /// </summary>
        public static readonly IsolatedStorageProperty<bool> IsTileUpdated =
            new IsolatedStorageProperty<bool>("tileUpdated", true, true, () => false);

        /// <summary>
        ///     Программа передач
        /// </summary>
        public static readonly StorageFile<DeepMixTrackContainer> Program =
            new StorageFile<DeepMixTrackContainer>("ProrgamTracks.xml", () => new DeepMixTrackContainer());

        /// <summary>
        ///     Записи передач
        /// </summary>
        public static readonly StorageFile<DeepMixTrackContainer> Selected =
            new StorageFile<DeepMixTrackContainer>("SelectedTracks.xml", () => new DeepMixTrackContainer());

        /// <summary>
        ///     Текущий трек в эфире
        /// </summary>
        public static readonly StorageFile<DeepMixTrack> OnAir = new StorageFile<DeepMixTrack>("CurrentTrack.xml",
                                                                                               () => null);

        /// <summary>
        ///     Папараци
        /// </summary>
        public static readonly StorageFile<object> Image = new StorageFile<object>("papar.jpg", null);

        /// <summary>
        ///     Звук ошибки
        /// </summary>
        public static readonly StorageFile<object> ErrorSound = new StorageFile<object>("error.wma", null);
    }
}